<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GtkOffscreenWindow</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GTK+ 3 参考手册">
<link rel="up" href="WindowWidgets.html" title="窗口">
<link rel="prev" href="gtk3-GtkAssistant.html" title="GtkAssistant">
<link rel="next" href="DisplayWidgets.html" title="显示构件">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gtk3-GtkAssistant.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="WindowWidgets.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GTK+ 3 参考手册</th>
<td><a accesskey="n" href="DisplayWidgets.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gtk3-GtkOffscreenWindow.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#gtk3-GtkOffscreenWindow.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="gtk3-GtkOffscreenWindow"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gtk3-GtkOffscreenWindow.top_of_page"></a>GtkOffscreenWindow</span></h2>
<p>GtkOffscreenWindow — A toplevel to manage offscreen rendering of child widgets</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gtk3-GtkOffscreenWindow.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gtk/gtk.h&gt;

struct              <a class="link" href="gtk3-GtkOffscreenWindow.html#GtkOffscreenWindow" title="struct GtkOffscreenWindow">GtkOffscreenWindow</a>;
<a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         <a class="link" href="gtk3-GtkOffscreenWindow.html#gtk-offscreen-window-new" title="gtk_offscreen_window_new ()">gtk_offscreen_window_new</a>            (<em class="parameter"><code><span class="type">void</span></code></em>);
<a href="../cairo/cairo-cairo-surface-t.html#cairo-surface-t"><span class="returnvalue">cairo_surface_t</span></a> *   <a class="link" href="gtk3-GtkOffscreenWindow.html#gtk-offscreen-window-get-surface" title="gtk_offscreen_window_get_surface ()">gtk_offscreen_window_get_surface</a>    (<em class="parameter"><code><a class="link" href="gtk3-GtkOffscreenWindow.html#GtkOffscreenWindow" title="struct GtkOffscreenWindow"><span class="type">GtkOffscreenWindow</span></a> *offscreen</code></em>);
<a href="../gdk-pixbuf/gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         <a class="link" href="gtk3-GtkOffscreenWindow.html#gtk-offscreen-window-get-pixbuf" title="gtk_offscreen_window_get_pixbuf ()">gtk_offscreen_window_get_pixbuf</a>     (<em class="parameter"><code><a class="link" href="gtk3-GtkOffscreenWindow.html#GtkOffscreenWindow" title="struct GtkOffscreenWindow"><span class="type">GtkOffscreenWindow</span></a> *offscreen</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="gtk3-GtkOffscreenWindow.description"></a><h2>Description</h2>
<p>
GtkOffscreenWindow is strictly intended to be used for obtaining
snapshots of widgets that are not part of a normal widget hierarchy.
Since <a class="link" href="gtk3-GtkOffscreenWindow.html#GtkOffscreenWindow" title="struct GtkOffscreenWindow"><span class="type">GtkOffscreenWindow</span></a> is a toplevel widget you cannot obtain
snapshots of a full window with it since you cannot pack a toplevel
widget in another toplevel.
</p>
<p>
The idea is to take a widget and manually set the state of it,
add it to a GtkOffscreenWindow and then retrieve the snapshot
as a <a href="../cairo/cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> or <a href="../gdk-pixbuf/gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>.
</p>
<p>
GtkOffscreenWindow derives from <a class="link" href="gtk3-GtkWindow.html#GtkWindow" title="GtkWindow"><span class="type">GtkWindow</span></a> only as an implementation
detail.  Applications should not use any API specific to <a class="link" href="gtk3-GtkWindow.html#GtkWindow" title="GtkWindow"><span class="type">GtkWindow</span></a>
to operate on this object.  It should be treated as a <a class="link" href="gtk3-GtkBin.html#GtkBin" title="struct GtkBin"><span class="type">GtkBin</span></a> that
has no parent widget.
</p>
<p>
When contained offscreen widgets are redrawn, GtkOffscreenWindow
will emit a <span class="type">"damage-event"</span> signal.
</p>
</div>
<div class="refsect1">
<a name="gtk3-GtkOffscreenWindow.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GtkOffscreenWindow"></a><h3>struct GtkOffscreenWindow</h3>
<pre class="programlisting">struct GtkOffscreenWindow {
  GtkWindow parent_object;
};
</pre>
<p>
</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-offscreen-window-new"></a><h3>gtk_offscreen_window_new ()</h3>
<pre class="programlisting"><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         gtk_offscreen_window_new            (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Creates a toplevel container widget that is used to retrieve
snapshots of widgets without showing them on the screen.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A pointer to a <a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.20</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-offscreen-window-get-surface"></a><h3>gtk_offscreen_window_get_surface ()</h3>
<pre class="programlisting"><a href="../cairo/cairo-cairo-surface-t.html#cairo-surface-t"><span class="returnvalue">cairo_surface_t</span></a> *   gtk_offscreen_window_get_surface    (<em class="parameter"><code><a class="link" href="gtk3-GtkOffscreenWindow.html#GtkOffscreenWindow" title="struct GtkOffscreenWindow"><span class="type">GtkOffscreenWindow</span></a> *offscreen</code></em>);</pre>
<p>
Retrieves a snapshot of the contained widget in the form of
a <a href="../cairo/cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a>.  If you need to keep this around over window
resizes then you should add a reference to it.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>offscreen</code></em> :</span></p></td>
<td>the <a class="link" href="gtk3-GtkOffscreenWindow.html#GtkOffscreenWindow" title="struct GtkOffscreenWindow"><span class="type">GtkOffscreenWindow</span></a> contained widget.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A <a href="../cairo/cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> pointer to the offscreen
surface, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.20</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-offscreen-window-get-pixbuf"></a><h3>gtk_offscreen_window_get_pixbuf ()</h3>
<pre class="programlisting"><a href="../gdk-pixbuf/gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         gtk_offscreen_window_get_pixbuf     (<em class="parameter"><code><a class="link" href="gtk3-GtkOffscreenWindow.html#GtkOffscreenWindow" title="struct GtkOffscreenWindow"><span class="type">GtkOffscreenWindow</span></a> *offscreen</code></em>);</pre>
<p>
Retrieves a snapshot of the contained widget in the form of
a <a href="../gdk-pixbuf/gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>.  This is a new pixbuf with a reference count of 1,
and the application should unreference it once it is no longer
needed.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>offscreen</code></em> :</span></p></td>
<td>the <a class="link" href="gtk3-GtkOffscreenWindow.html#GtkOffscreenWindow" title="struct GtkOffscreenWindow"><span class="type">GtkOffscreenWindow</span></a> contained widget.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A <a href="../gdk-pixbuf/gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> pointer, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.20</p>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.18</div>
</body>
</html>